package top.datacluster.basic.algorithm.leetcode.dynamic;

public class LeetCode1551 {

    public int cuttingRope(int n) {
        if (n == 2){
            return 1;
        }
        if (n == 3){
            return 2;
        }
        if (n == 4){
            return 4;
        }
        int max = 1;
        while (n > 4){
            max = max * 3;
            n = n - 3;
        }
        if (n == 2){
            max = max * 2;
        }
        if (n == 3){
            max = max * 3;
        }
        if (n == 4){
            max = max * 4;
        }
        return max;



    }
}
